<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-image: url('https://img.yumesakura.com/image/2024/12/05/vq4gg1.png');
            background-size: cover; /* 让图片覆盖整个页面 */
            background-position: center center; /* 居中显示背景 */
            background-attachment: fixed; /* 背景固定 */
            height: 100vh;
            margin: 0;
        }

        .all {
        }

        .BigContainer {
            position:relative;
            top: 200px;
            margin: auto;
            backdrop-filter: blur(18px); /* 模糊背景，控制模糊的程度 */
            padding: 30px;
            border-radius: 8px;
            box-shadow: none; /* 去掉阴影 */
            width: 100%;
            max-width: 400px;
            text-align: center;
        }


        h1 {
            font-size: 40px;
            margin-bottom: 40px;
            color: black;
        }

        .form-group {
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            justify-content: flex-start;
            text-align: left;
        }

        label {
            width: 100px;
            font-size: 25px;
            color: black;
            font-weight: 500;
            margin-left: 0px;
            margin-right: 0px;
        }

        input {
            width: 70%;
            padding: 12px;
            border: 1px solid rgba(255, 255, 255, 0.3); /* 浅色透明边框 */
            border-radius: 8px;
            font-size: 1rem;
            box-sizing: border-box;
            background: rgba(255, 255, 255, 0.3); /* 输入框的半透明背景 */
            color: black;
            transition: border-color 0.3s, box-shadow 0.3s;
        }

            input:focus {
                outline: none;
                border-color: #007bff;
                box-shadow: 0 0 8px rgba(0, 123, 255, 0.5);
            }

        button {
            width: 100%;
            padding: 14px;
            background: linear-gradient(45deg, #007bff, #00b0ff); /* 渐变背景 */
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 1.1rem;
            cursor: pointer;
            transition: background 0.3s, transform 0.3s;
            margin-top: 20px;
        }

            button:hover {
                background: linear-gradient(45deg, #0056b3, #0080ff);
                transform: translateY(-3px); /* 按钮上浮效果 */
            }

            button:active {
                transform: translateY(2px); /* 按钮按下效果 */
            }

        .message {
            margin-top: 20px;
            color: red;
            font-size: 1rem;
        }

        .popup {
            position: fixed;
            top: -100px;
            left: 50%;
            transform: translateX(-50%);
            opacity: 0;
            width: 300px;
            padding: 20px;
            background-color: #fff;
            border-radius: 10px;
            color: #333;
            text-align: center;
            font-size: 16px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
            z-index: 10000;
            transition: all 0.5s ease-out;
        }

        .popup-message {
            font-size: 18px;
            font-weight: bold;
        }

        .popup-success {
            background-color: #4CAF50;
            color: white;
        }

        .popup-failure {
            background-color: #f44336;
            color: white;
        }

        .popup-show {
            top: 20px;
            opacity: 1;
        }

        .popup-hide {
            top: -100px;
            opacity: 0;
        }
    </style>
</head>

<body>
    @*弹窗*@
    <div id="popup" class="popup">
        <div id="popupMessage" class="popup-message"></div>
    </div>
    <div class="all">
        <div class="BigContainer">
            @using (Html.BeginForm("Login", "Home", FormMethod.Post))
            {
                <h1>登录</h1>
                <div class="form-group">
                    <label for="UserName">账号：</label>
                    <input type="text" id="UserName" placeholder="请输入账号" name="UserName" required />
                </div>
                <div class="form-group">
                    <label for="PassWord">密码：</label>
                    <input type="password" id="PassWord" placeholder="请输入密码" name="PassWord" required />
                </div>
                <button type="submit">登录</button>
            }
        </div>
    </div>

    <script>
        var isLoginSuccess = '@ViewBag.IsSuccess'.toLowerCase();

        function hidePopup() {
            var popup = document.getElementById("popup");
            popup.classList.remove("popup-show");
            popup.classList.add("popup-hide");
        }

        function showPopup(status) {
            var popup = document.getElementById("popup");
            var message = document.getElementById("popupMessage");

            if (status === 'success') {
                message.textContent = "@ViewBag.Message";
                popup.className = "popup popup-success";
            } else if (status === 'failure') {
                message.textContent = "登录失败，请重试！";
                popup.className = "popup popup-failure";
            }

            hidePopup();
            setTimeout(function () {
                popup.style.display = 'block';
                popup.classList.remove("popup-hide");
                popup.classList.add("popup-show");
            }, 500);

            setTimeout(function () {
                popup.classList.remove("popup-show");
                popup.classList.add("popup-hide");
            }, 2050);

            setTimeout(function () {
                popup.style.display = 'none';
                popup.classList.remove("popup-hide");
            }, 2550);
        }

        if (isLoginSuccess === 'true') {
            showPopup('success');
        } else if (isLoginSuccess === 'false') {
            showPopup('failure');
        }
    </script>
</body>

</html>